﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPagePrivate.master" AutoEventWireup="true" CodeFile="SubscribePackage.aspx.cs" Inherits="Pages_Private_SubscribePackage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeader" Runat="Server">
    <script language="javascript" type="text/javascript">
        function ValidatePackageSelection(sender, args) {
            //alert($("#tblPackageList input[name='rdbPackage']:checked").length);        
            if ($("#tblPackageList input[name='rdbPackage']:checked").length > 0)
                args.IsValid = true;
            else
                args.IsValid = false;
        }

// Hide by Siddik, 20.09.11
//        $(document).ready(function () {
//            if ($('#<%=hdnAction.ClientID %>').val() == 'PayOnline') {
//                $("form[name='_xclick']").submit();
//            }
//        });
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageBody" Runat="Server">
    <h4 id="h4Heading" runat="server">Package Subscription</h4>
    <div id="divMessage" runat="server" visible="false" enableviewstate="false"></div>

    <asp:Panel ID="pnlFormContainer" runat="server">
        <div id="divStep_1" class="WizardContainer" style="display:block;">
            <div class="StepHeaderContainer">
                <div class="StepHeading">
                    <asp:Label ID="lblMemberShipType" runat="server" Text="Subscribe to a Package"></asp:Label>
                </div>
                <div class="StepSubHeading"><asp:Label ID="Label1" runat="server" Text="Select a Package from the list below to subscribe."></asp:Label></div>
            </div>
            <div class="StepBody">
                <div style="margin-bottom:10px;">                
                    <asp:CustomValidator ID="cvPackageSelection" runat="server"
                        Display="Dynamic" ValidateEmptyText="true"
                        ClientValidationFunction="ValidatePackageSelection"
                        ErrorMessage="Select a Package to Subscribe with it."
                        ValidationGroup="SaveInfo">
                    </asp:CustomValidator>                
                </div>
                <asp:Repeater ID="rptPackageList" runat="server">
                    <HeaderTemplate>
                        <table id="tblPackageList" class="GridView" cellpadding="3" cellspacing="0">
                            <colgroup>
                                <col style="width:50px;" />
                                <col />
                                <col />
                                <col />
                                <col />
                            </colgroup>
                            <tr>
                                <th style="text-align:center;">Select</th>
                                <th>Name</th>
                                <th>Price</th>
                                <th>Duration</th>
                                <th>Max #of Projects</th>                                
                            </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr class="OddRowListing">                            
                            <td style="text-align:center;"><input type="radio" name="rdbPackage" value='<%# DataBinder.Eval(Container.DataItem, "ID") %>'/></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Name") %></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Currency Symbol")%><%# DataBinder.Eval(Container.DataItem, "Price")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Duration")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "ProductLimit")%></td>
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <tr class="EvenRowListing">                            
                            <td style="text-align:center;"><input type="radio" name="rdbPackage" value='<%# DataBinder.Eval(Container.DataItem, "ID") %>'/></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Name") %></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Currency Symbol")%><%# DataBinder.Eval(Container.DataItem, "Price")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "Duration")%></td>
                            <td><%# DataBinder.Eval(Container.DataItem, "ProductLimit")%></td>
                        </tr>
                    </AlternatingItemTemplate>
                    <FooterTemplate>
                        </table>        
                    </FooterTemplate>
                </asp:Repeater>     
                
                <%--
                Hide by Siddik, 20.09.11
                <div style="margin:15px 0px 10px 10px;">
                    <asp:RadioButton ID="rdbSendInvoice" runat="server" GroupName="Payment" Text="Send Invoice" Checked="true" />&nbsp;&nbsp;
                    <asp:RadioButton ID="rdbPayOnline" runat="server" GroupName="Payment" Text="Pay Online" />
                </div>  --%>         
            </div>
            <div class="StepButtonContainer">
                <asp:Button ID="btnSave" runat="server" Text="Send Request" ValidationGroup="SaveInfo" OnClick="btnSave_Click"/><%-- OnClientClick="return PaymentOption();"--%>
            </div>
        </div>
    </asp:Panel>
    <asp:HiddenField id="hdnAction" runat="server" Value="" />
</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="PayPalForm" Runat="Server">
    <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_xclick"/>
        <input type="hidden" name="business" value="<%=ConfigReader.PaypalAccountID %>"/>
        <input type="hidden" name="currency_code" value="USD"/>
        <input type="hidden" name="item_name" value="<%=_ItemName %>"/>
        <input type="hidden" name="amount" value="<%=_Price %>"/>
        <%--<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">--%>
    </form>
</asp:Content>

